<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="static/easyui/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/metisMenu/metisMenu_custom.css" />
<link rel="stylesheet" href="static/css/style.css" />
<script src="static/jquery/jquery-1.12.4.js"></script>
<script src="static/easyui/jquery.easyui.min.js"></script>
<script src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<script src="static/jqueryValidate/jquery.validate.min.js"></script>
<script src="static/jqueryValidate/additional-methods.min.js"></script>
<script src="static/jqueryValidate/localization/messages_zh.min.js"></script>
<script src="static/moment/moment.js"></script>
<script src="static/moment/locale/zh-cn.js"></script>
<script src="static/js/base-loading.js"></script>
<title>项目管理</title>
</head>

<body>

	<div class="content-container" data-options="region:'center'" title="" style="float:left;width:55%;">
	<div class="panel-header"><div class="panel-title">项目列表</div></div>
		<table id="pro_table" class="easyui-datagrid" style="height: 100%">
		</table>
		<div id="pro_tb">
		<div>
			发布日期：
			<input id="fromDate" class="easyui-datebox" editable="false"  />
			~
			<input id="toDate" class="easyui-datebox" editable="false"  />
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" id="search">搜索</a>
		</div>
	</div>
	</div>
	
	<div id="proDlg" class="easyui-dialog info_dialog" style="width: 800px; padding: 10px 20px" closed="true"
		buttons="#pro-dlg-buttons">
		<div class="title"></div>
		<form id="proFm" method="post">
			<div class="content_container">
				<table class="content_table">
					<tr>
						<td style="width: 100px;">项目名：</td>
						<td>
							<input class="easyui-textbox" id="name" name="name" data-options="required:true" style="width: 200px;" />
						</td>
						<td style="width: 100px;">立项号：</td>
						<td>
							<input class="easyui-textbox" id="projectno" name="projectno"
								data-options="required:true,validType:'projectnovalidate'" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">工程概况：</td>
						<td colspan="4">
							<input class="easyui-textbox" id="summary" name="summary" data-options="required:true,multiline:true"
								style="width: 550px; height: 80px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 120px;">预算成本(元)：</td>
						<td>
							<input class="easyui-textbox" id="compactmoney" name="compactmoney"
								data-options="required:true,validType:'number'" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">开始日期：</td>
						<td>
							<input class="easyui-datebox" id="startdate" name="startdate"
								data-options="required:true,editable:false" style="width: 200px;" />
						</td>
						<td style="width: 100px;">结束日期：</td>
						<td>
							<input class="easyui-datebox" id="enddate" name="enddate"
								data-options="required:true,editable:false,validType:'end'" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">项目负责人：</td>
						<td>
							<input style="width: 200px;" id="level2" name="level2" class="easyui-combobox"
								data-options="
							    valueField: 'id',
							    textField: 'name',
							    multiple:true,
							   	required:true,
							    url: 'level.do?roleid=3',
							    onSelect: function(rec){
							    
							    },panelHeight: 'auto',
							     editable:false">
						</td>

						<td style="width: 100px;">现场负责人：</td>
						<td>
							<input style="width: 200px;" id="level3" name="level3" class="easyui-combobox"
								data-options="
							    valueField: 'id',
							    textField: 'name',
							    multiple:true,
							   	required:true,
							    url: 'level.do?roleid=4',
							    onSelect: function(rec){
							    
							    },panelHeight: 'auto',
							    editable:false">
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">建设方：</td>
						<td>
							<input style="width: 200px;" id="level4" name="level4" class="easyui-combobox"
								data-options="
							    valueField: 'id',
							    textField: 'name',
							   	required:true,
							    multiple:true,
							    url: 'level.do?roleid=6',
							    onSelect: function(rec){
							    
							    },panelHeight: 'auto',
							    editable:false">
						</td>

						<td style="width: 100px;">建设方地址：</td>
						<td>
							<input class="easyui-textbox" id="clientaddr" name="clientaddr" data-options="" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">电话号码：</td>
						<td>
							<input class="easyui-textbox" id="clienttel" name="clienttel" style="width: 200px;" />
						</td>
						<td style="width: 100px;">施工地址：</td>
						<td>
							<input class="easyui-textbox" id="projectaddr" name="projectaddr" style="width: 200px;" />
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div id="pro-dlg-buttons">
		<a href="# " class="easyui-linkbutton btn-cancel "
			onclick="javascript:$('#proDlg').dialog('close')">取消</a>
	</div>

	<div class="content-container" data-options="region:'center'" style="float:left;width:45%;border-left:1px solid #ddd">
		<div class="panel-header"><div class="panel-title">子项目列表</div></div>
		<table id="child_table" class="easyui-datagrid" style="height: 100%">
		</table>
	</div>
	<div id="childDlg" class="easyui-dialog info_dialog" style="width: 800px; padding: 10px 20px" closed="true"
		buttons="#child-dlg-buttons">
		<div class="title"></div>
		<form id="childFm" method="post">
			<div class="content_container">
				<table class="content_table">
					<tr>
						<td style="width: 100px;">子项目名：</td>
						<td>
							<input class="easyui-textbox" id="childname" name="childname" data-options="required:true"
								style="width: 200px;" />
						</td>
						<td style="width: 100px;">立项号：</td>
						<td>
							<input class="easyui-textbox" id="childprojectno" name="childprojectno" data-options="required:true"
								style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">工程概况：</td>
						<td colspan="4">
							<input class="easyui-textbox" id="childcontent" name="childcontent"
								data-options="required:true,multiline:true" style="width: 550px; height: 80px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 120px;">预算成本(元)：</td>
						<td>
							<input class="easyui-textbox" id="childcompactmoney" name="childcompactmoney"
								data-options="required:true,validType:'number'" style="width: 200px;" />
						</td>
						<td style="width: 120px;">百分比：</td>
						<td>
							<input class="easyui-textbox" id="childpercent" name="childpercent"
								data-options="required:true,validType:'number'" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">开始日期：</td>
						<td>
							<input class="easyui-datebox" id="childstartdate" name="childstartdate"
								data-options="required:true,editable:false" style="width: 200px;" />
						</td>
						<td style="width: 100px;">结束日期：</td>
						<td>
							<input class="easyui-datebox" id="childenddate" name="childenddate"
								data-options="required:true,editable:false" style="width: 200px;" />
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">班组长：</td>
						<td>
							<input style="width: 200px;" id="levelchild2" name="levelchild2" class="easyui-combobox"
								data-options="
							    valueField: 'id',
							    textField: 'name',
							    multiple:true,
							   	required:true,
							    onSelect: function(rec){
							    
							    },panelHeight: 'auto',
							     editable:false">
						</td>
					</tr>
					<tr>
						<td style="width: 100px;">班组成员：</td>
						<td colspan="3">
							<input style="width: 550px; height: 80px" id="levelchild3" name="levelchild3" class="easyui-combotree"
								data-options="
							    valueField: 'id',
							    textField: 'name',
							    multiline:true,
							    multiple:true,
							   	required:true,
							   	url:'usertree.do',
							    onSelect: function(rec){
							    
							    },panelHeight: 'auto',
							    editable:false">
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div id="child-dlg-buttons">
		<a href="# " class="easyui-linkbutton btn-cancel "
			onclick="javascript:$('#childDlg').dialog('close')">取消</a>
	</div>

	<div id="_proDlg" class="easyui-dialog info_dialog"
		style="width: 800px; padding: 10px 20px; max-height: 80%; overflow-y: auto; top: 30px;" closed="true">
		<ul id="companyTree" class="easyui-tree"></ul>
	</div>
</body>
<script>
	var currentPro;
	var currentChild;
	var fromDate = "";
	var toDate = "";
	$(document).ready(function() {
		fromDate = getLastMonth().last;
		toDate = getLastMonth().now;
		$("#fromDate").datebox('setValue', fromDate);
		$("#toDate").datebox('setValue', toDate);
		$('#pro_table').datagrid({
			rownumbers : true,
			singleSelect : true,
			pagination : true,
			fitColumns : false,
			border : false,
			striped : true,
			toolbar : '#pro_tb',
			url : "level3/projectitems.do",
			method : 'get',
			queryParams : {
				startdate : fromDate,
				enddate : toDate
			},
			onSelect : function(index,row) {
				currentPro = row;
				refreshChildTable();
			},
			onDblClickRow : function(index,row) {
				currentPro = row;
				updatepro();
			},
			columns : [ [ {
				field : 'name',
				title : '项目名',
				width : ''
			},{
				field : 'projectno',
				title : '立项号',
				width : ''
			},{
				field : 'creatername',
				title : '发布人',
				width : '',
				formatter : function(value,row,index) {
					if (row.creater){
						return row.creater.name;
					}else{
						return '';
					}
				}
			},{
				field : 'startdate',
				title : '开始日期',
				width : '',
				formatter : formatDate
			},{
				field : 'enddate',
				title : '结束日期',
				width : '',
				formatter : formatDate
			},{
				field : 'createdate',
				title : '发布日期',
				width : '',
				formatter : formatDate
			},{
				field : 'projectaddr',
				title : '施工地址',
				width : ''
			},{
				field : 'status',
				title : '状态',
				width : '',
				formatter : function(value,row,index){
					if(value==1){
						return value='待确认';
					}
					if(value==2){
						return value='进行中';
					}
					if(value==3){
						return value='废止';
					}
					if(value==5){
						return value='结束';
					}
				}
			},{
				field : 'association',
				title : '关联追溯',
				width : '',
				formatter : function(value,row,index) {
					return '<a class="c-orange" href="#" onclick="association(' + index + ')">关联追溯</a>'
				}
			} ] ]
		});
		$('#child_table').datagrid({
			toolbar : '#child_tb'
		});
	});
	function refreshProTable() {
		$('#pro_table').datagrid("load", {
			startdate : fromDate,
			enddate : toDate
		});
	}
	function refreshChildTable() {
		$('#child_table').datagrid({
			rownumbers : true,
			singleSelect : true,
			pagination : true,
			fitColumns : false,
			border : false,
			striped : true,
			toolbar : '#child_tb',
			url : "projectitemchilds?projectitemid=" + currentPro.id,
			method : 'get',
			onSelect : function(index,row) {
				currentChild = row;
			},
			onDblClickRow : function(index,row) {
				currentChild = row;
				updatechild();
			},
			columns : [ [ {
				field : 'name',
				title : '项目名',
				width : ''
			},{
				field : 'projectno',
				title : '立项号',
				width : ''
			},{
				field : 'creatername',
				title : '发布人',
				width : '',
				formatter : function(value,row,index) {
					if (row.creater){
						return row.creater.name;
					}else{
						return '';
					}
				}
			},{
				field : 'startdate',
				title : '开始日期',
				width : '',
				formatter : formatDate
			},{
				field : 'enddate',
				title : '结束日期',
				width : '',
				formatter : formatDate
			},{
				field : 'createdate',
				title : '发布日期',
				width : '',
				formatter : formatDate
			},{
				field : 'status',
				title : '状态',
				width : '',
				formatter : function(value,row,index) {
					if (value == 1){
						return value = '待确认';
					}
					if (value == 2){
						return value = '进行中';
					}
					if (value == 3){
						return value = '废止';
					}
					if (value == 5){
						return value = '结束';
					}
				}
			},{
				field : 'association',
				title : '关联追溯',
				width : '',
				formatter : function(value,row,index) {
					return '<a class="c-orange" href="#" onclick="associationchild(' + index + ')">关联追溯</a>'
				}
			} ] ]
		});
	}
	function newpro() {
		$("#proDlg").dialog('open').dialog('setTitle', '添加项目');
		$("#proFm").form('clear');
		$("#name").textbox("enable");
		currentPro = {};
	}
	function updatepro() {
		currentPro = $("#pro_table").datagrid('getSelected');
		if (currentPro){
			$("#proDlg").dialog('open').dialog('setTitle', '更新项目');
			$("#proFm").form('load', {
				name : currentPro.name,
				projectno : currentPro.projectno,
				summary : currentPro.summary,
				companymoney : currentPro.companymoney,
				clientaddr : currentPro.clientaddr,
				clienttel : currentPro.clienttel,
				projectaddr : currentPro.projectaddr
			});
			$("#name").textbox("disable");
			$("#startdate").datebox("setValue", formatDate(currentPro.startdate));
			$("#enddate").datebox("setValue", formatDate(currentPro.enddate));
			var arr2 = new Array(currentPro.level2.length);
			for(var i = 0;i < arr2.length;i++){
				arr2[i] = currentPro.level2[i]
			}
			$("#level2").combobox("setValue", arr2);
			var arr3 = new Array(currentPro.level3.length);
			for(var i = 0;i < arr3.length;i++){
				arr3[i] = currentPro.level3[i]
			}
			$("#level3").combobox("setValue", arr3);
			var arr4 = new Array(currentPro.level4.length);
			for(var i = 0;i < arr4.length;i++){
				arr4[i] = currentPro.level4[i]
			}
			$("#level4").combobox("setValue", arr4);
			$.get("encryptMoney.do?compactmoney=" + currentPro.compactmoney + "&projectitemid=" + currentPro.id,
					function(result) {
						$("#compactmoney").textbox('setValue', result);
					});
		}else{
			$.messager.alert('更新', '请选择要更新的项目', 'warning');
		}
	}
	function deletepro() {
		currentPro = $("#pro_table").datagrid('getSelected');
		if (currentPro){
			$.messager.confirm("操作提示", "您确定要执行操作吗？", function(data) {
				if (data){
					$.ajax({
						type : 'POST',
						url : "ProjectItemOff.do?id=" + currentPro.id,
						contentType : "application/json",
						success : function(data) {
							if (data.success){
								$.messager.show({
									title : '禁用',
									msg : '禁用成功',
									timeout : 5000,
									showType : 'slide'
								});
								refreshProTable();
							}else{
								$.messager.alert('禁用', '禁用失败', 'error');
								refreshProTable();
							}
						},
						dataType : "json"
					});
				}else{
				}
			});
		}else{
			$.messager.alert('更新', '请选择要禁用的项目', 'warning');
		}
	}
	$("#search").click(function() {
		fromDate = $("#fromDate").datebox('getValue');
		toDate = $("#toDate").datebox('getValue');
		refreshProTable();
	});
	function savePro() {
		if (!$("#proFm").form('validate'))
			return;
		currentPro.name = $("#name").textbox('getValue');
		currentPro.projectno = $("#projectno").textbox('getValue');
		currentPro.summary = $("#summary").textbox('getValue');
		currentPro.companymoney = $("#companymoney").textbox('getValue');
		currentPro.compactmoney = $("#compactmoney").textbox('getValue');
		currentPro.startdate = $("#startdate").datebox('getValue');
		currentPro.enddate = $("#enddate").datebox('getValue');
		currentPro.clientaddr = $("#clientaddr").textbox('getValue');
		currentPro.clienttel = $("#clienttel").textbox('getValue');
		currentPro.projectaddr = $("#projectaddr").textbox('getValue');
		currentPro.duty2 = $("#level2").combobox('getValues');
		currentPro.duty3 = $("#level3").combobox('getValues');
		currentPro.duty4 = $("#level4").combobox('getValues');
		if (!currentPro.status){
			currentPro.status = 1;
		}
		$.ajax({
			type : 'POST',
			url : "ProjectItemSave.do",
			data : JSON.stringify(currentPro),
			contentType : "application/json",
			/* beforeSend:function(){
			    $(btn).attr('onclick','javascript:void(0);');
			}, */
			success : function(data) {
				/* $(btn).removeAttr('onclick'); */
				$('#proDlg').dialog('close');
				if (data.success){
					$.messager.show({
						title : '保存项目',
						msg : '保存项目成功',
						timeout : 5000,
						showType : 'slide'
					});
					refreshProTable();
				}else{
					$.messager.alert('保存项目', '保存项目失败', 'error');
				}
			},
			/* error:function(){
			    $(btn).removeAttr('onclick')
			}, */
			dataType : "json"
		});
	}
	function newchild() {
		if (currentPro){
			var url = 'duty3.do?projectitemid=' + currentPro.id
			$('#levelchild2').combobox('reload', url);
			$("#childDlg").dialog('open').dialog('setTitle', '添加子项目');
			$("#childFm").form('clear');
			currentChild = {};
			$('#childname').textbox('setValue', currentPro.name + "-");
			$('#childprojectno').textbox('setValue', currentPro.projectno + "-");
		}else{
			$.messager.alert('更新', '请选择项目', 'warning');
		}
	}
	function updatechild() {
		currentChild = $("#child_table").datagrid('getSelected');
		console.log(currentChild)
		if (currentChild){
			$("#childDlg").dialog('open').dialog('setTitle', '更新子项目');
			$("#childFm").form('load', {
				childname : currentChild.name,
				childprojectno : currentChild.projectno,
				childcontent : currentChild.content,
				childcompactmoney : currentChild.compactmoney,
				childpercent : currentChild.percent
			});
			$("#childname").textbox("disable");
			$("#childstartdate").datebox("setValue", formatDate(currentChild.startdate));
			$("#childenddate").datebox("setValue", formatDate(currentChild.enddate));
			var arr2 = new Array(currentChild.level2.length);
			for(var i = 0;i < arr2.length;i++){
				arr2[i] = currentChild.level2[i]
			}
			$("#levelchild2").combobox("setValue", arr2);
			var arr3 = new Array(currentChild.level3.length);
			for(var i = 0;i < arr3.length;i++){
				arr3[i] = currentChild.level3[i]
			}
			$("#levelchild3").combotree("setValue", arr3);
		}else{
			$.messager.alert('更新', '请选择要更新的项目', 'warning');
		}
	}
	function saveChild() {
		if (!$("#childFm").form('validate'))
			return;
		currentChild.name = $("#childname").textbox('getValue');
		currentChild.projectitemid = currentPro.id;
		currentChild.projectno = $("#childprojectno").textbox('getValue');
		currentChild.content = $("#childcontent").textbox('getValue');
		currentChild.percent = $("#childpercent").textbox('getValue');
		currentChild.compactmoney = $("#childcompactmoney").textbox('getValue');
		currentChild.startdate = $("#childstartdate").datebox('getValue');
		currentChild.enddate = $("#childenddate").datebox('getValue');
		currentChild.duty2 = $("#levelchild2").combobox('getValues');
		currentChild.duty3 = $("#levelchild3").combobox('getValues');
		if (!currentChild.status){
			currentChild.status = 2;
		}
		$.ajax({
			type : 'POST',
			url : "ProjectItemChildSave.do",
			data : JSON.stringify(currentChild),
			contentType : "application/json",
			success : function(data) {
				if (data.success){
					$.messager.show({
						title : '保存子项目',
						msg : '保存子项目成功',
						timeout : 5000,
						showType : 'slide'
					});
					refreshChildTable();
				}else{
					$.messager.alert('保存子项目', '保存子项目失败', 'error');
				}
				$('#childDlg').dialog('close');
			},
			dataType : "json"
		});
	}
	function deletechild() {
		var row = $("#child_table").datagrid('getSelected');
		if (row){
			var status;
			if (row.status == 2){
				status = 3;
			}else{
				status = 2
			}
			$.ajax({
				type : 'POST',
				url : "ProjectItemChildDelete.do",
				data : {
					id : row.id,
					status : status
				},
				success : function(data) {
					if (data.success){
						$.messager.show({
							title : '操作',
							msg : '操作成功',
							timeout : 5000,
							showType : 'slide'
						});
						refreshChildTable();
					}else{
						$.messager.alert('操作', '操作失败', 'error');
					}
				},
				dataType : "json"
			});
		}else{
			$.messager.alert('操作', '请选择要启用/禁用的子项目', 'warning');
		}
	}
	function formatDate(time) {
		var date = new Date(time);
		var year = date.getFullYear(),month = date.getMonth() + 1, //月份是从0开始的
		day = date.getDate(),hour = date.getHours(),min = date.getMinutes(),sec = date.getSeconds();
		var newTime = year + '-' + month + '-' + day;
		return newTime;
	}
	$.extend($.fn.textbox.defaults.rules, {
		number : {//value值为文本框中的值
			validator : function(value) {
				var reg = /^\d+(\.\d+)?$/;
				return reg.test(value);
			},
			message : "请输入数字"
		},
		end : {
			validator : function(value,param) {
				var startDate = $("#startdate").val();
				var startTmp = new Date(startDate.replace(/-/g, "/"));
				var endTmp = new Date(value.replace(/-/g, "/"));
				return startTmp <= endTmp;
			},
			message : '结束时间不能早于开始时间！'
		},
		end2 : {
			validator : function(value,param) {
				var startDate = $("#childstartdate").val();
				var startTmp = new Date(startDate.replace(/-/g, "/"));
				var endTmp = new Date(value.replace(/-/g, "/"));
				return startTmp <= endTmp;
			},
			message : '结束时间不能早于开始时间！'
		},
		chinese : {
			validator : function(value,param) {
				var reg = /^[\u4e00-\u9fa5]+$/i;
				return reg.test(value);
			},
			message : "请输入中文"
		},
		checkLength : {
			validator : function(value,param) {
				return param[0] >= get_length(value);
			},
			message : '请输入最大{0}位字符'
		},
		specialCharacter : {
			validator : function(value,param) {
				var reg = new RegExp("[`~!@#$^&*()=|{}':;'\\[\\]<>~！@#￥……&*（）——|{}【】‘；：”“'、？]");
				return !reg.test(value);
			},
			message : '不允许输入特殊字符'
		},
		comboxRequired : {
			validator : function(value,param) {
				return value != param[0];
			},
			message : '该输入项为必须项'
		},
		projectnovalidate : {
			validator : function(value,param) {
				var projectitem = {};
				projectitem.projectno = value.trim();
				if (currentPro.id){
					projectitem.id = currentPro.id;
				}else{
					projectitem.id = -1;
				}
				var res = false;
				$.ajax({
					type : 'POST',
					async : false,
					url : 'check/projectitemno',
					data : projectitem,
					success : function(data) {
						res = data.success;
					},
					dataType : "json"
				});
				return res;
			},
			message : '立项号已存在'
		}
	});
	function association(index) {
		var item = $("#pro_table").datagrid('getRows')[index];
		var title = '关联追溯-' + item.name;
		window.parent.window.addTab(title, "associationprojectitems.do?projectitemid=" + item.id, item.id);
	}
	function associationchild(index) {
		var item = $("#child_table").datagrid('getRows')[index];
		var title = '关联追溯-' + item.name;
		window.parent.window.addTab(title, "associationprojectitemchilds.do?projectitemchildid=" + item.id, item.id);
	}
	function getLastMonth() {
		var now = new Date();
		var year = now.getFullYear();
		var month = now.getMonth() + 1;//0-11表示1-12月
		var day = now.getDate() + 1;
		var dateObj = {};
		dateObj.now = year + '-' + month + '-' + day;
		var nowMonthDay = new Date(year, month, 0).getDate(); //当前月的总天数
		if (month - 1 <= 0){ //如果是1月，年数往前推一年<br>　　　　 
			dateObj.last = (year - 1) + '-' + 12 + '-' + day;
		}else{
			var lastMonthDay = new Date(year, (parseInt(month) - 1), 0).getDate();
			if (lastMonthDay < day){ //1个月前所在月的总天数小于现在的天日期
				if (day < nowMonthDay){ //当前天日期小于当前月总天数
					dateObj.last = year + '-' + (month - 1) + '-' + (lastMonthDay - (nowMonthDay - day));
				}else{
					dateObj.last = year + '-' + (month - 1) + '-' + lastMonthDay;
				}
			}else{
				dateObj.last = year + '-' + (month - 1) + '-' + day;
			}
		}
		return dateObj;
	}
</script>

</html>